package com.example.shop.fgo.base;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.example.shop.library.base.BaseFragment;

/**
 * Created by Administrator on 2017/1/20.
 */

public abstract class YBaseFragment extends BaseFragment {
    private boolean isFirstDownload=true;
    private boolean isonCreateView=false;
    @Override
    public boolean isNeedTitle() {
        return false;
    }

    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if (isFirstDownload&&isVisibleToUser&&isonCreateView) {
            isFirstDownload=false;
            firstInit();
        }
    }
    protected abstract void firstInit();

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        isonCreateView=true;
        return super.onCreateView(inflater, container, savedInstanceState);

    }
}
